const { override, fixBabelImports, addWebpackAlias } = require('customize-cra')
const path = require('path')
const CopyWebpackPlugin = require('copy-webpack-plugin');

module.exports = override(
    fixBabelImports('import', {
        libraryName: 'antd',
        libraryDirectory: 'es',
        style: 'css'
    }),
    addWebpackAlias({
        ['@']: path.resolve(__dirname, 'src'),
    }),
    (config)=>{
        config.plugins = [
            ...config.plugins,
            new CopyWebpackPlugin([
                {
                  from: path.resolve(process.cwd(), 'src/assets'),
                  to: 'assets'
                },
                // {
                //   from: path.resolve(process.cwd(), 'api/v1/icons?path=icons'),
                //   to: 'icons'
                // }
            ])
        ]
        return config;
    }
)
